<!-- 首页 -->
<template>
  <div class="body">
      <b>getters中处理的-{{$store.getters.showNum}}</b>
      <h2>getters处理数据列表年龄大于18的-{{$store.getters.moreAge18}}</h2>
      <h3>当前最新的count值是:{{$store.state.count}}</h3>
      <i>-----------{{$store.getters.moreAge18Length}}-----------</i>
      <button @click="handle1">+1</button>
      <button @click="handle2">+N</button>
      <button @click="handle3">+异步</button>
      <button @click="handle4">+异步N</button>
  </div>
</template>

<script>
export default {
  methods: {
    handle1(){
      this.$store.commit("add")
    },
    handle2(){ //commit作用  就是调用某个mutation函数
      this.$store.commit("add2",3)
    },
    
    handle3(){  //这里的dispath函数 专门用来触发 action
      this.$store.dispatch("addAsync")
    },
    handle4(){  //这里的dispath函数 专门用来触发 action
      this.$store.dispatch("addNasync",5)
    }
  }
}
</script>

<style  scoped>
</style>
